package com.community.admin.controller;

import com.community.admin.common.Result;
import com.community.admin.dto.LoginDTO;
import com.community.admin.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @PostMapping("/login")
    public Result<String> login(@Validated @RequestBody LoginDTO loginDTO) {
        String token = sysUserService.login(loginDTO.getUsername(), loginDTO.getPassword());
        return Result.success(token);
    }
} 